﻿<%@ Page Language="C#" MasterPageFile="~/Shared/FormPage.Master" AutoEventWireup="true"
    CodeBehind="AccessoryStockOut.aspx.cs" Inherits="Runda.CMS.Portal.StockManagement.AccessoryStockOut" %>

<%@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script src="../Content/jquery-1.3.2.js" type="text/javascript"></script>

    <script src="../Content/global.js" type="text/javascript"></script>

    <script src="../Content/Grid/map_grid.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="../Content/Grid/mapgrid.css" />
    <link href="../Content/Menu/Menu.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Grid/Grid.css" rel="stylesheet" type="text/css" />
    <link href="../Content/global.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Find/find.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Tab/tabs.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../Content/global.css" />

    <script language="javascript" src="../Content/settings.aspx"></script>

    <script src="../Content/lookup/Lookup.js" type="text/javascript"></script>

    <link href="../Content/Form/form.css" rel="Stylesheet" type="text/css" />

    <script language="javascript" src="../Content/Detail.js"></script>

    <script language="javascript" src="../Content/lookup/Lookup.js"></script>

    <script language="javascript" src="../Content/Menu/menu.js"></script>

    <script language="javascript" src="../Content/util.js"></script>

    <script type="text/javascript" src="../Content/DateTime/date.js"></script>

    <script type="text/javascript" src="../Content/DateTime/time.js"></script>

    <script type="text/javascript">
        function CheckForm() {
            if (document.getElementById('<%=OutstockDate.ClientID %>').value == '' || document.getElementById('<%=OutstockDate.ClientID %>').value == null) {
                alert('请指定出库日期!');
                return false;
            }

            if (document.getElementById('<%=ddloutStocktype.ClientID %>').value == '' || document.getElementById('<%=ddloutStocktype.ClientID %>').value == null) {
                alert('请指定出库类型!');
                return false;
            }
        }

        function CheckFormDetail() {
            if (document.getElementById('<%=hiddenInstrumentID.ClientID %>').value == '' || document.getElementById('<%=hiddenInstrumentID.ClientID %>').value == null) {
                alert('请选择出库配件!');
                return false;
            }
            if (document.getElementById('<%=employeeGUID.ClientID %>').value == '' || document.getElementById('<%=employeeGUID.ClientID %>').value == null) {
                alert('请指定申领人!');
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphFormArea" runat="server">
     <rad:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <rad:AjaxSetting AjaxControlID="lnkbtnSaveAndNew">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="gridSubItems" />                  
                </UpdatedControls>
            </rad:AjaxSetting>                         
            <rad:AjaxSetting AjaxControlID="gridSubItems">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="gridSubItems" LoadingPanelID="AjaxLoadingPanel"/>                              
                </UpdatedControls>
            </rad:AjaxSetting>   
        </AjaxSettings>                                
    </rad:RadAjaxManager>
    
    <rad:AjaxLoadingPanel runat="server" ID="AjaxLoadingPanel">
        <img src="../Images/loadding_orange.gif" /> 加载中...
    </rad:AjaxLoadingPanel>
    <table class="layout" cellspacing="0" cellpadding="0">
        <colgroup>
            <col width="140">
            <!-- 导航菜单：140px -->
            <col />
        </colgroup>
        <tbody>
            <tr>
                <td class="leftBar">
                    <span class="leftBar" id="appNavBar" defaultarea="__appNavBar_navInfo">
                        <div class="lbItem" tabindex="0" title="主要信息" id="__appNavBar_navInfo">
                            <img src="/Images/info_16_wihte.gif" align="absmiddle">&nbsp; 主要信息</div>
                    </span>

                    <script language="javascript">                        function _createIframe() { }</script>

                </td>
                <td id="tdAreas">
                    <div class="area" id="areaForm">
                        <table class="mnubar" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr>
                                    <td width="9">
                                        <img hspace="3" src="../Content/Menu/mnu_vSpacer.gif">
                                    </td>
                                    <td class="icMenu" nowrap>
                                        <asp:LinkButton ID="link_saveBill" runat="server" OnClick="link_saveBill_Click"  OnClientClick="return CheckForm();"><span class="menu" title="保存;"><img class="mnuBtn" src="../Content/Menu/SaveNew_16_blue.gif"><span class="mnuBtn">保存</span></span></asp:LinkButton>
                                        <img src="../Content/Menu/separator.gif">
                                        <span class="menu" title="关闭" onclick="window.close();">
                                            <img class="mnuBtn" src="../Content/Menu/Close_16_blue.gif"><span class="mnuBtn">关闭</span></span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div style="border-bottom: #c2c2bf 1px solid; border-top: #969693 1px solid">
                        </div>
                        <div id="areaForm2" class="area">
                            <asp:HiddenField runat="server" ID="hiddenOutID" />
                            <table cellspacing="0" cellpadding="0" width="100%" height="190px">
                                <tbody>
                                    <tr>
                                        <td valign="top">
                                            <div style="display: inline" id="appForm_tab0" class="tab">
                                                <table style="table-layout: fixed" id="Section1" cellspacing="0" cellpadding="3"
                                                    width="100%">
                                                    <colgroup>
                                                        <col width="110">
                                                        <col>
                                                        <col width="110">
                                                        <col>
                                                    </colgroup>
                                                    <tbody>
                                                        <tr>
                                                            <td>
                                                                    出库日期
                                                            </td>
                                                            <td>
                                                                <rad:RadDatePicker ID="OutstockDate" runat="server" Culture="Chinese (People's Republic of China)"
                                                                    Skin="WebBlue" Width="100%">
                                                                    <DateInput Skin="WebBlue">
                                                                    </DateInput>
                                                                    <Calendar Skin="WebBlue">
                                                                    </Calendar>
                                                                </rad:RadDatePicker>
                                                            </td>
                                                            <td>
                                                                出库单号
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lblRequestCode" runat="server" Text=""></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                出库类型
                                                            </td>
                                                            <td >
                                                                <asp:DropDownList ID="ddloutStocktype" runat="server" AutoPostBack="true" 
                                                                    onselectedindexchanged="ddloutStocktype_SelectedIndexChanged">
                                                                    <asp:ListItem Text="请选择" Value="" />
                                                                    <asp:ListItem Text="借用" Value="借用" />
                                                                    <asp:ListItem Text="销售单" Value="销售单" />
                                                                    
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                备注
                                                            </td>
                                                            <td colspan="3">
                                                                <asp:TextBox runat="server" ID="Memo" TextMode="MultiLine" Height="35px"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                        <%--<tr>
                                                            <td>配件来源</td>
                                                            <td>
                                                                <asp:DropDownList ID="ddlStockSource" runat="server">
                                                                    <asp:ListItem Text="请选择" Value="0" />
                                                                    <asp:ListItem Text="厂家借用" Value="厂家借用" />
                                                                    <asp:ListItem Text="保内索赔" Value="保内索赔" />
                                                                    <asp:ListItem Text="保外厂家采购" Value="保外厂家采购" />
                                                                    <asp:ListItem Text="外购" Value="外购" />
                                                                    <asp:ListItem Text="制造" Value="制造" />
                                                                    <asp:ListItem Text="拆仪器" Value="拆仪器" />
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>--%>
                                                        <tr>
                                                            <td class="req">
                                                                配件
                                                            </td>
                                                            <td>
                                                                <table cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed;">
                                                                    <tr>
                                                                        <td nowrap>
                                                                            <div class="lu" detailpage="/SyncManage/InstrumentList.aspx?InstrumentCategoryGUID=">
                                                                                <span class="lui" oid="" runat="server" onclick="openlui();" id="hiddenAccesssoryName"
                                                                                    runat="server"></span>&nbsp;</div>
                                                                        </td>
                                                                        <td width="25" style="text-align: right;">
                                                                            <img class="lu2" id="parmT" lookupstyle="single" features="dialogWidth:360px;dialogHeight:500px;resizable:yes;center:yes;status:no;help:no;scroll:no;"
                                                                                lookupcustom="" src="/Images/btn_off_lookup.gif" lookupclass="Accessory" lookupbrowse="0"
                                                                                additionalparams="" /><input maptype="lu" id="hiddenInstrumentID" class="lu" type="hidden"
                                                                                    runat="server" name="hiddenAccessoryID" value="" runat="server" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                            <td>
                                                                单位
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="Unit" runat="server"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="display:none">
                                                                数量
                                                            </td>
                                                            <td  style="display:none">
                                                                <rad:RadNumericTextBox ID="accessoryCount" runat="server">
                                                                </rad:RadNumericTextBox>
                                                            </td>
                                                            <td>
                                                                借用人
                                                            </td>
                                                            <td>
                                                                <table cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed;">
                                                                    <tr>
                                                                        <td nowrap>
                                                                            <div class="lu">
                                                                                <span class="lui" oid="" onclick="openlui();"></span>
                                                                                <asp:Label ID="employeeName" runat="server"></asp:Label></div>
                                                                        </td>
                                                                        <td width="25" style="text-align: right;">
                                                                            <img class="lu2" lookupbrowse="" lookupstyle="single" lookupclass="" features="dialogWidth:360px;dialogHeight:500px;resizable:yes;center:yes;status:no;help:no;scroll:no;"
                                                                                lookupcustom="/Lookup/selectcustomeroflookup.aspx?title=user" src="/Images/btn_off_lookup.gif"><input
                                                                                    maptype="lu" class="lu" type="hidden" name="employeeGUID" value="" runat="server"
                                                                                    id="employeeGUID">
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                        <td>
                                                                    预计归还时间
                                                            </td>
                                                            <td>
                                                                <rad:RadDatePicker ID="PreBackdate" runat="server" Culture="Chinese (People's Republic of China)"
                                                                    Skin="WebBlue" Width="120">
                                                                    <DateInput Skin="WebBlue">
                                                                    </DateInput>
                                                                    <Calendar Skin="WebBlue">
                                                                    <SpecialDays>  
                                                                            <rad:RadCalendarDay Date="" Repeatable="Today">  
                                                                                <ItemStyle CssClass="radCalToday_WebBlue" />  
                                                                            </rad:RadCalendarDay>  
                                                                        </SpecialDays> 
                                                                    </Calendar>
                                                                </rad:RadDatePicker>
                                                            </td>
                                                        <td colspan="3" style="color:Red"> （如配件未领用，请在约定的时间内归还。）                                                         
                                                        </td>
                                                        <td></td>
                                                        
                                                        </tr>
                                                        
                                                    </tbody>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div style="border-bottom: #c2c2bf 1px solid; border-top: #969693 1px solid">
                        </div>
                        <div style="margin: 5px 0 5px 0">
                        </div>
                        <table class="mnubar" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr>
                                    <td style="padding-left: 5px" nowrap>
                                        <b>出库明细</b>
                                    </td>
                                    <td style="padding-left: 5px">
                                        <img src="../Content/Grid/separator.gif">
                                    </td>
                                    <td class="icMenu" nowrap>
                                    </td>
                                    <td class="icMenu mnuRight" nowrap>
                                        <asp:LinkButton ID="lnkbtnSaveAndNew" runat="server" OnClick="lnkbtnSaveAndNew_Click"  OnClientClick="return CheckFormDetail();" ><span class="menu" title="添加出库明细"><span class="mnuBtn">新  增</span></span></asp:LinkButton>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <rad:RadGrid runat="server" ID="gridSubItems" Skin="OCM" AutoGenerateColumns="False"
                            AllowSorting="false" GridLines="None" EnableAJAX="true" EnableAJAXLoadingTemplate="True"
                            OnItemCommand="gridSubItems_ItemCommand" OnItemDataBound="gridSubItems_ItemDataBound">
                            <AJAXLoadingTemplate>
                                <img src="../Images/loadding_orange.gif" />
                                加载中...
                            </AJAXLoadingTemplate>
                            <MasterTableView DataKeyNames="AccessoryID">
                                <Columns>                
                                 <rad:GridTemplateColumn>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkAccessory" runat="server" />
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>                                                                         
                                      <rad:GridTemplateColumn HeaderText="厂家代码">
                                        <ItemTemplate>
                                            <asp:Label ID="AccessoryCompanyNum" runat="server" Text='<%#Eval("AccessoryCompanyNum") %>'>
                                            </asp:Label>                                             
                                               <asp:Label ID="AccessoryID" runat="server" Visible="false"  Text='<%#Eval("AccessoryID") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                    <rad:GridTemplateColumn HeaderText="名称">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="AccessoryName" runat="server"  Text='<%#Eval("AccessoryName") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                     <rad:GridTemplateColumn HeaderText="单位">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="Unit" runat="server" Text='<%#Eval("Unit") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                         <rad:GridTemplateColumn HeaderText="StockID" Visible="false">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="StockID" runat="server" Text='<%#Eval("StockID") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                     <rad:GridTemplateColumn HeaderText="物品识别号">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="AccessoryCode" runat="server" Text='<%#Eval("AccessoryCode") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                     <rad:GridTemplateColumn HeaderText="申领人">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="ReceiverName" runat="server" Text='<%#Eval("ReceiverName") %>'>
                                            </asp:Label>
                                            <asp:Label ID="Receiver" runat="server" Visible="false"  Text='<%#Eval("Receiver") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                    <rad:GridTemplateColumn HeaderText="预计归还时间">
                                        <ItemTemplate>                                           
                                             <asp:Label ID="PreBackdate" runat="server" Text='<%#Eval("PreBackdate") %>'>
                                            </asp:Label>
                                        </ItemTemplate>
                                    </rad:GridTemplateColumn>
                                    <rad:GridButtonColumn CommandName="delete" Text="删除">
                                    </rad:GridButtonColumn>
                                </Columns>
                            </MasterTableView>
                        </rad:RadGrid>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="statusBar" colspan="2">
                </td>
            </tr>
        </tbody>
    </table>
</asp:Content>
